# coding: utf-8
from marshmallow import Schema, fields
from model.model_base import Base
from sqlalchemy import Column, String, Integer, Numeric, DateTime, Text
from sqlalchemy.dialects.postgresql import ARRAY


class PendingProSupSta(Base):
    # 待处理问题统计表（按供电所督办）
    __tablename__ = 'PendingProSupSta'
    bureauid = Column(String(2), primary_key=True, comment='供电局编号')
    bureauname = Column(String(50), nullable=True, comment='供电局名称')
    stationid = Column(String(2), primary_key=True, comment='供所编号')
    stationname = Column(String(50), nullable=True, comment='供电所名称')
    pending_number = Column(Integer, nullable=True, comment='待处理问题总数')
    pending_percent = Column(Numeric(5, 2), nullable=True, comment='待处理问题占比')
    max_supervision_no = Column(Integer, nullable=True, comment='最大督办次数')
    max_pending_days = Column(Integer, nullable=True, comment='最长未处理天数')
    operation_time = Column(DateTime, nullable=True, comment='运维最新督办时间')
    director_time = Column(DateTime, nullable=True, comment='营销主任最新督办时间')
    leader_time = Column(DateTime, nullable=True, comment='营销局长最新督办时间')
    monitor_time = Column(DateTime, nullable=True, comment='计量班长最新督办时间')
    read_flag = Column(ARRAY(String), nullable=True, comment='阅读字符串数组')

class PendingProSupStaSchema(Schema):
    bureauid = fields.String()
    bureauname = fields.String()
    stationid = fields.String()
    stationname = fields.String()
    pending_number = fields.Integer()
    pending_percent = fields.Number()
    max_supervision_no = fields.Integer()
    max_pending_days = fields.Integer()
    operation_time = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    director_time = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    leader_time = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    monitor_time = fields.DateTime(format="%Y-%m-%d %H:%M:%S.%f")
    read_flag = fields.List(fields.String())

pendingProSupStaSchema = PendingProSupStaSchema()
